﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using ConsoleApp1.Modals.Entity;

namespace ConsoleApp1.Modals
{
    public class DbInitializer : DropCreateDatabaseIfModelChanges<Admin2000DbContext>
    {
        protected override void Seed(Admin2000DbContext context)
        {
            var class1 = new Class
            {
                ClassName = "老陈"
            };

            var class2 = new Class
            {
                ClassName = "老胡"
            };

            context.Classes.Add(class1);
            context.Classes.Add(class2);

            context.SaveChanges();

            var student1 = new Student
            {
                StudentName = "大魔王焕",
                ShortDesc = "无敌",
                DetailsDesc = "英俊 潇洒 美男子",
                Remarks = "无敌的我又回来了",
                ClassId = class2.Id
            };
            context.Students.Add(student1);
            context.SaveChanges();

            base.Seed(context);
        }
    }
}
